<?php
	//includes
	require_once 'includes.php';

	$startTime = microtime() + time();
	
	$beerItem = new BeerItem();
	$beers = $beerItem->GetList($_GET['offset'], $_GET['number']);
	
	$result = array('success' => 0, 'fail' => 0);
	
	//saves beers
	foreach ($beers as $beer)
	{
		//copy image
		$saveResult = $beerItem->CrawlCountry($beer);
		
		//stats
		if ($saveResult)
		{
			$result['success']++;
		}
		else 
		{
			$result['fail']++;
		}		
	}

	$endTime = microtime() + time();
	
	//totals
	$resultTime = $endTime - $startTime;
	echo "Total time: $resultTime; Success: {$result['success']}; Fail: {$result['fail']}; ";		
	
?>